﻿<phone:PhoneApplicationPage 
    x:Class="WeiboSdk.SharePageView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:WeiboSdk"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    Loaded="PhoneApplicationPage_Loaded"
    shell:SystemTray.IsVisible="false"
    >
    
	<phone:PhoneApplicationPage.Resources>
        <Style x:Name="AppBarText" TargetType="ContentControl">
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Padding" Value="0" />
        </Style>
        <ControlTemplate x:Key="RoundButtonControlTemplate" TargetType="local:RoundButton">
                    <StackPanel Orientation="{TemplateBinding Orientation}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
										</ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonForeground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonForeground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentBody">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Width="72" Height="72" Margin="0,-10,0,-8">
                            <Ellipse
								x:Name="ButtonBackground"
								Stroke="{TemplateBinding BorderBrush}" 
								StrokeThickness="{StaticResource PhoneStrokeThickness}" 
								Fill="{TemplateBinding Background}" 
								Margin="{StaticResource PhoneTouchTargetOverhang}" />
							<Ellipse
								x:Name="ButtonForeground" 
								Fill="{TemplateBinding Foreground}" 
								Margin="{StaticResource PhoneTouchTargetOverhang}">
								<Ellipse.OpacityMask>
									<ImageBrush x:Name="OpacityImageBrush" />
								</Ellipse.OpacityMask>
							</Ellipse>
						</Grid>
						<ContentControl 
                            x:Name="ContentBody" 
                            Content="{TemplateBinding Content}" 
                            FontSize="13.333"
                            Style="{StaticResource AppBarText}" Margin="0,-8,0,0"/>
                    </StackPanel>
		</ControlTemplate>
        <Style x:Key="S_btnClear" TargetType="Button">
        	<Setter Property="Background" Value="Transparent"/>
        	<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
        	<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        	<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        	<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
        	<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        	<Setter Property="Padding" Value="0"/>
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="Button">
        				<Grid Background="Transparent">
        					<VisualStateManager.VisualStateGroups>
        						<VisualStateGroup x:Name="CommonStates">
        							<VisualState x:Name="Normal"/>
        							<VisualState x:Name="MouseOver"/>
        							<VisualState x:Name="Pressed">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        							<VisualState x:Name="Disabled">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        						</VisualStateGroup>
        					</VisualStateManager.VisualStateGroups>
        					<Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
        						<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
        					</Border>
        				</Grid>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
        <Style x:Key="S_tbxSendWeibo" TargetType="TextBox">
            <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
            <Setter Property="Background" Value="White"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
            <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/>
            <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/>
            <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
            <Setter Property="Padding" Value="2"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                    </VisualState>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="EnabledBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="{StaticResource PhoneTouchTargetOverhang}">
                                <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch"  Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch" Margin="10,12,0,0"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </phone:PhoneApplicationPage.Resources>
	<phone:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar >
            <shell:ApplicationBarIconButton IconUri="/WeiboIcons/appbar_publish.png" Text="发送" Click="ApplicationBarIconButton_SendClick"/>
            <shell:ApplicationBarIconButton IconUri="/WeiboIcons/appbar_TakePhoto.png" Text="添加图片" Click="ApplicationBarIconButton_AddPicClick"/>
            <shell:ApplicationBarIconButton IconUri="/WeiboIcons/appbar_topic.png" Text="添加话题" Click="ApplicationBarIconButton_AddTopicClick"/>
		</shell:ApplicationBar>
	</phone:PhoneApplicationPage.ApplicationBar>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" >
        <Grid.Background>
            <ImageBrush ImageSource="/WeiboSdk;component/Icons/background.jpg" Stretch="None"/>
        </Grid.Background>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentGrid" Margin="12,0,12,0" Grid.Row="1" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid x:Name="HeaderGrid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Image Source="/WeiboSdk;component/Icons/logo.png" Margin="16,0,4,-4" RenderTransformOrigin="0.594,-0.094"/>
                <TextBlock Margin="10,0,0,0" x:Name="TitleBlock" d:LayoutOverrides="Width, Height" Foreground="#333333"  FontWeight="Bold" FontSize="21.333" VerticalAlignment="Bottom" Grid.Column="1"/>
                <TextBlock x:Name="CountTitleBlock" Text="剩余字数：" Foreground="#333333" Grid.Column="2" HorizontalAlignment="Right" d:LayoutOverrides="Height" VerticalAlignment="Bottom"/>
                <TextBlock x:Name="CountBlock" d:LayoutOverrides="Height" Grid.Column="3" HorizontalAlignment="Right" Margin="0,0,10,-5" FontSize="32" Text="{Binding WordCount}" Width="50" VerticalAlignment="Bottom">
        			<TextBlock.Foreground>
        				<SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
        			</TextBlock.Foreground>
                </TextBlock>
            </Grid>
            <TextBox x:Name="StatusMessageBox" 
                     Grid.Row="1"  
                     TextChanged="StatusMessageBox_TextChanged" 
                     Height="360" MaxLength="140" 
					 BorderBrush="#333333" 
                     Style="{StaticResource S_tbxSendWeibo}"
					 Foreground="Black"
                     TextWrapping="Wrap" 
                     AcceptsReturn="True" Margin="0,12,0,-12">
            	<TextBox.Background>
            		<SolidColorBrush Color="white"/>
            	</TextBox.Background>
            </TextBox>
            <StackPanel x:Name="ChosenPicPanel" HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="2" d:LayoutOverrides="Height" Margin="12" Visibility="Collapsed">
                <Border x:Name="PicBorder" BorderThickness="2" Padding="3" d:LayoutOverrides="Width" >
                    <Border.Background>
                        <SolidColorBrush Color="{StaticResource PhoneChromeColor}"/>
                    </Border.Background>
                    <Border.BorderBrush>
                        <SolidColorBrush Color="{StaticResource PhoneBorderColor}"/>
                    </Border.BorderBrush>
                    <Image x:Name="ChosenPic"  Stretch="Uniform" d:LayoutOverrides="HorizontalAlignment, Height" />
                </Border>
				
                <Button x:Name="CancelButton" BorderThickness="0" Width="60" Height="60" VerticalAlignment="Top" Margin="-36,0,0,0" HorizontalAlignment="Left" Click="CancelButton_Click" Style="{StaticResource S_btnClear}" >
                  <Image Source="/WeiboSdk;component/Icons/ClearTxtImg.png"/>
                </Button>
            </StackPanel>
            <StackPanel x:Name="PhotoPicker" Orientation="Vertical" Grid.Row="2" d:LayoutOverrides="Height" VerticalAlignment="Bottom" Visibility="Collapsed">
                <StackPanel.Background>
                    <SolidColorBrush Color="{StaticResource PhoneBackgroundColor}"/>
                </StackPanel.Background>
                <Border BorderThickness="2" Padding="10" VerticalAlignment="Bottom">
                    <Border.BorderBrush>
                        <SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
                    </Border.BorderBrush>
                    <StackPanel>
                        <Button x:Name="LibPickerButton" Content="从图库中选择" Click="LibPickerButton_Click" BorderThickness="0" >
                        	<Button.Background>
                        		<SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
                        	</Button.Background>
                        </Button>
                        <Button x:Name="CameraPickerButton" Content="拍照获取" Click="CameraPickerButton_Click" BorderThickness="0" >
                        	<Button.Background>
                        		<SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
                        	</Button.Background>
                        	<Button.BorderBrush>
                        		<SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
                        	</Button.BorderBrush>
                        </Button>
                    </StackPanel>
                </Border>
                <Path x:Name="Arrow" Data="M0,0 L16,16 L32,0 Z" Stretch="None" HorizontalAlignment="Left" Margin="212,0,0,0" UseLayoutRounding="False">
                    <Path.Fill>
                        <SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
                    </Path.Fill>
                </Path>
            </StackPanel>
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>
